#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <map>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class VideoPlayer;
class VideoSlider;
class QListWidgetItem;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void init();
    void initBtns();
    QString getTimeText(int value);
    void play(const QString& fileName);
    void play(const std::string& fileName);
public slots:
    void onOpenFileActionTriggered(bool checked = false);
    void onBtnPlayClicked();
    void onBtnStopClicked();
    void onBtnPrevClicked();
    void onBtnNextClicked();
    void onBtnVolumeClicked();
    void onPlayerStateChanged(VideoPlayer *player);
    void onPlayerInitFinished(VideoPlayer *player);
    void onPlayerTimeChanged(VideoPlayer* player);
    void onCurrentSliderValueChanged(int value);
    void onSliderClicked(VideoSlider *slider);
    void onMoreBtnClicked();
    void attchMenuToMoreBtn();
    void setUIParams();
    void onBtnMinimizeClicked();
    void onBtnMaxMizeClicked();
    void onBtnCloseClicked();
    void onBtnExpandClicked();
    void onFileNameItemDoubleClicked(QListWidgetItem* item);
private:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void recordWriteFileName();
    void recordWriteFilePath();
    void recordReadFileName();
    void recordReadFilePath();
    void loadPlayList();
    QPoint m_dragStartPosition;
    std::map<int,std::string> m_mapFileName;
    std::map<int,std::string> m_mapFilePath;
    Ui::MainWindow *ui;
    VideoPlayer *m_player;
};
#endif // MAINWINDOW_H
